<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <hr>
        <nav-bar></nav-bar>
        <hr>
        <nav-bar></nav-bar>
        <hr>
        <nav-bar></nav-bar>
        <hr>
        <nav-bar></nav-bar>
        <hr>
    </div>
</body>
<script>
    // 自定义vue组件实例
    // Vue.component("组件名",组件配置)
    Vue.component("nav-bar",{
        template:"<h1 style='color:red' @click='showTip()'>自定义头部导航</h1>",
        methods: {
            showTip(){
                alert(1)
            }
        },
    });


    new Vue({
        el:"#app"
    })
</script>
</html>